﻿@using FwProject.EventAdvertising.Dto
@model ShopSecondkillOutputDto
@section styles{
}
<style>
    a {
        text-decoration: none;
    }

    .layui-index {
        padding: 15px;
    }

    .layui-table td, .layui-table th {
        font-size: 14px;
        text-align: center;
    }
</style>
<div class="layui-index">
    <form class="layui-form layui-form-pane" action="@Url.Action("Edit",new { id=ViewBag.Id})" method="post" novalidate="novalidate" data-ajax="true" data-ajax-success="ReloadAjaxCallbackgoback" data-ajax-failure="FailureAjaxCallback" data-ajax-method="Post" role="form" lay-filter="form1">
        @Html.AntiForgeryToken()
        <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
            <legend>秒杀活动</legend>
        </fieldset>
        <div class="layui-form-item">
            <label class="layui-form-label">秒杀标题</label>
            <div class="layui-input-block">
                @Html.TextBox("SecondkillTitle", Model.SecondkillTitle, new { @class = "layui-input", @placeholder = "请输入标题", @lay_verify = "required" })
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">时间范围</label>
            <div class="layui-input-block">
                @Html.TextBox("SecondkillDateRange", Model.SecondkillBeginTime.ToString("yyyy-MM-dd HH:mm:ss") + " ~ " + Model.SecondkillEndTime.ToString("yyyy-MM-dd HH:mm:ss"), new { @class = "layui-input" , @autocomplete = "off" })
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">秒杀价格</label>
            <div class="layui-input-inline">
                @Html.TextBoxFor(o => o.SecondkillPrice, new { @class = "layui-input", @lay_verify = "number" })
                @Html.ValidationMessageFor(o => o.SecondkillPrice)
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">总仓库数</label>
            <div class="layui-input-inline">
                @Html.TextBoxFor(o => o.SecondkillCount, new { @class = "layui-input", @lay_verify = "number" })
                @Html.ValidationMessageFor(o => o.SecondkillCount)
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">最大购买数</label>
            <div class="layui-input-inline">
                @Html.TextBoxFor(o => o.SecondkillSingleCount, new { @class = "layui-input", @lay_verify = "number" })
                @Html.ValidationMessageFor(o => o.SecondkillSingleCount)
            </div>
        </div>

        <div class="layui-form-item">
            <button class="layui-btn" lay-submit="" lay-filter="demo2">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </form>
</div>
@section scripts{
    <script src="~/js/main.js"></script>
    <script type="text/javascript">
        layui.use(['form', 'layedit', 'laydate', 'table', 'layer', 'element', 'upload'], function () {
            var form = layui.form
                , layer = layui.layer
                , layedit = layui.layedit
                , laydate = layui.laydate
                , table = layui.table;

            //日期时间范围
            laydate.render({
                elem: '#SecondkillDateRange'
                , type: 'datetime'
                , range: "~"
                , calendar: true
            });


            //自定义验证规则
            form.verify({
                required: function (value) {
                    if (value == "") {
                        return '必填项不能为空';
                    }
                }
            });

        });

        $(document).ready(function () {


        });

        function ReloadAjaxCallbackgoback(data, successInfo) {
            if (data.success) {
                layer.msg('保存成功！', { time: 2000, end: function () { top.CloseTab(121515) } })
            } else {
                layer.msg('保存失败：' + successInfo);
            }
        }


    </script>
}
